using FServer.Core.Entities;

namespace FServer.Core.Interfaces;

/// <summary>
/// 游戏服务器管理服务接口
/// </summary>
public interface IGameServerService
{
    /// <summary>
    /// 获取服务器列表
    /// </summary>
    /// <param name="region">区域筛选</param>
    /// <param name="serverType">服务器类型筛选</param>
    /// <returns>服务器列表</returns>
    Task<List<GameServer>> GetServerListAsync(string? region = null, string? serverType = null);
    
    /// <summary>
    /// 获取推荐服务器
    /// </summary>
    /// <param name="region">区域</param>
    /// <returns>推荐服务器</returns>
    Task<GameServer?> GetRecommendedServerAsync(string? region = null);
    
    /// <summary>
    /// 根据ID获取服务器信息
    /// </summary>
    /// <param name="serverId">服务器ID</param>
    /// <returns>服务器信息</returns>
    Task<GameServer?> GetServerAsync(Guid serverId);
    
    /// <summary>
    /// 更新服务器状态
    /// </summary>
    /// <param name="serverId">服务器ID</param>
    /// <param name="status">状态</param>
    /// <param name="currentConnections">当前连接数</param>
    /// <param name="loadPercentage">负载百分比</param>
    /// <returns>是否成功</returns>
    Task<bool> UpdateServerStatusAsync(Guid serverId, string status, int currentConnections, int loadPercentage);
    
    /// <summary>
    /// 注册服务器
    /// </summary>
    /// <param name="server">服务器信息</param>
    /// <returns>注册的服务器</returns>
    Task<GameServer> RegisterServerAsync(GameServer server);
    
    /// <summary>
    /// 注销服务器
    /// </summary>
    /// <param name="serverId">服务器ID</param>
    /// <returns>是否成功</returns>
    Task<bool> UnregisterServerAsync(Guid serverId);
    
    /// <summary>
    /// 服务器心跳
    /// </summary>
    /// <param name="serverId">服务器ID</param>
    /// <returns>是否成功</returns>
    Task<bool> HeartbeatAsync(Guid serverId);
}
